<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="__STATIC__/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="__STATIC__/css/font.css">
    <link rel="stylesheet" href="__STATIC__/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="__STATIC__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__STATIC__/js/xadmin.js"></script>
</head>

<body>

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
    <li class="layui-this">微信配置</li>
    <li>支付配置</li>
  </ul>
<div class="layui-tab-content">
	<div class="layui-tab-item layui-show">
        <form class="layui-form" id="form1">
            <input type="hidden" name="id" value="{$wechat.id}"/>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>appID
                </label>
                <div class="layui-input-inline">
                    <input type="text"  name="appID" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$wechat.appID}">
                </div>
            </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>Secret
                </label>
                <div class="layui-input-inline">
                    <input type="text"  name="secret" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$wechat.secret}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button class="layui-btn" lay-filter="add" lay-submit="">
                    保存
                </button>
            </div>
        </form>
	</div>
	<div class="layui-tab-item">
        <form class="layui-form" id="form2">
            <input type="hidden" name="id" value=""/>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>appID
                </label>
                <div class="layui-input-inline">
                    <input type="text"  name="appID" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$wechat.appID}">
                    <input type="hidden" name="id" value="{$wechat.id}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>mch_id
                </label>
                <div class="layui-input-inline">
                    <input type="text"  name="mch_id" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$wechat.mch_id}">
                </div>
            </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>key
                </label>
                <div class="layui-input-inline">
                    <input type="text"  name="key" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$wechat.key}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button class="layui-btn" lay-filter="add1" lay-submit="">
                    保存
                </button>
            </div>
        </form>
	    </div>
	</div>
</div>

<script type="text/javascript">
    layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form
            , layer = layui.layer;
        //监听提交
        form.on('submit(add)', function (data) {
            //
            $.post('{:url("wechat/wechatSave")}',data.field,function (res) {
                if (res.code == 1){
                    layer.msg(res.msg, {icon: 6,time:1000}, function () {
                        window.location.reload();
                    });
                }else {
                    layer.msg(res.msg, {icon: 5,time:1000});
                }
            });
            return false;
        });
        form.on('submit(add1)',function (data) {
            $.post('{:url("wechat/wechatSave")}',data.field,function (res) {
                if (res.code == 1){
                    layer.msg(res.msg, {icon: 6,time:1000}, function () {
                        window.location.reload();
                    });
                }else {
                    layer.msg(res.msg, {icon: 5,time:1000});
                }
            });
            return false;
        });
    });
</script>
</body>

</html>
